export default function(fn,wait,options=false){
    let time=null
    return function(){
        let tach=this
        let ars=arguments
        if(!time&&options){
            fn.call(tach,...ars)
        }
        if(!time){
            time = setTimeout(() => {
                fn.call(tach)
                time=null
            }, wait);
        }else{
            clearTimeout(time)
            time = setTimeout(() => {
                fn.call(tach,...ars)
                time=null
            }, wait);
        }
    }

}